package homepage

import (
	"github.com/gin-gonic/gin"
	"go-papers/models"
	"go-papers/tools"
	"go-papers/tools/app"
)

func GetBrandAll(c *gin.Context) {
	var data models.OrganBrand
	var err error
	if index := c.Request.FormValue("brandId"); index != "" {
		data.BrandId = tools.StrToInt(err, index)
	}

	data.BrandName = c.Request.FormValue("brandName")
	data.BrandRegister = c.Request.FormValue("brandRegister")
	data.BrandCompany = c.Request.FormValue("brandCompany")
	data.BrandQualify = c.Request.FormValue("brandQualify")
	data.BrandFinancing = c.Request.FormValue("brandFinancing")
	data.CreateBy = c.Request.FormValue("createBy")
	data.UpdateBy = c.Request.FormValue("updateBy")
	data.ApprovalStatus = c.Request.FormValue("approvalStatus")
	data.ApprovalAt = c.Request.FormValue("approvalAt")
	data.UpdateStart = c.Request.FormValue("updateStart")
	data.UpdateEnd = c.Request.FormValue("updateEnd")
	data.ApprovalUserId = c.Request.FormValue("approvalUserId")
	data.ApprovalUserName = c.Request.FormValue("approvalUserName")

	result, err := data.GetPageAll()
	if err != nil {
		app.ApiResp(c, -1, "数据操作失败："+err.Error(), nil)
		return
	}

	app.CommonResp(c, 0, "", result)
}
